-
Notifications
You must be signed in to change notification settings - Fork 15k
[AArch64] Correctly disassemble TSB instruction #156362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AArch64] Correctly disassemble TSB instruction #156362
Conversation
fa1e14d to
fe7aa77
Compare
a2f1143 to
067f93e
Compare
fe7aa77 to
8b1424a
Compare
067f93e to
235b15d
Compare
8b1424a to
c82858d
Compare
b1cd999 to
6ff221b
Compare
f7326ba to
b62d843
Compare
6ff221b to
d3e77cd
Compare
b62d843 to
d80acf2
Compare
1346d77 to
f88e35a
Compare
d80acf2 to
f8f5688
Compare
|
@llvm/pr-subscribers-backend-aarch64 Author: Sergei Barannikov (s-barannikov) ChangesTSB instruction has one operand, but the generated disassembler is unable to decode it since the operand is not encoded into the instruction. AArch64InstPrinter has a special case for this instruction. With the changes proposed by #156358, the operand can now be decoded automatically and the workaround is no longer required. Full diff: https://github.com/llvm/llvm-project/pull/156362.diff 3 Files Affected:
diff --git a/llvm/lib/Target/AArch64/AArch64SystemOperands.td b/llvm/lib/Target/AArch64/AArch64SystemOperands.td
index 1b0e90b0e0dc3..65b752ed40c90 100644
--- a/llvm/lib/Target/AArch64/AArch64SystemOperands.td
+++ b/llvm/lib/Target/AArch64/AArch64SystemOperands.td
@@ -362,7 +362,7 @@ def lookupTSBByName : SearchIndex {
let Key = ["Name"];
}
-def : TSB<"csync", 0>;
+def : TSB<"csync", 2>;
//===----------------------------------------------------------------------===//
// PRFM (prefetch) instruction options.
diff --git a/llvm/lib/Target/AArch64/CMakeLists.txt b/llvm/lib/Target/AArch64/CMakeLists.txt
index 833ce48ea1d7a..79b56ea9cf850 100644
--- a/llvm/lib/Target/AArch64/CMakeLists.txt
+++ b/llvm/lib/Target/AArch64/CMakeLists.txt
@@ -8,8 +8,7 @@ tablegen(LLVM AArch64GenAsmWriter1.inc -gen-asm-writer -asmwriternum=1)
tablegen(LLVM AArch64GenCallingConv.inc -gen-callingconv)
tablegen(LLVM AArch64GenDAGISel.inc -gen-dag-isel)
tablegen(LLVM AArch64GenDisassemblerTables.inc -gen-disassembler
- -ignore-non-decodable-operands
- -ignore-fully-defined-operands)
+ -ignore-non-decodable-operands)
tablegen(LLVM AArch64GenFastISel.inc -gen-fast-isel)
tablegen(LLVM AArch64GenGlobalISel.inc -gen-global-isel)
tablegen(LLVM AArch64GenO0PreLegalizeGICombiner.inc -gen-global-isel-combiner
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
index 54b58e948daf2..2552ee3009338 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
@@ -365,13 +365,6 @@ void AArch64InstPrinter::printInst(const MCInst *MI, uint64_t Address,
return;
}
- // Instruction TSB is specified as a one operand instruction, but 'csync' is
- // not encoded, so for printing it is treated as a special case here:
- if (Opcode == AArch64::TSB) {
- O << "\ttsb\tcsync";
- return;
- }
-
if (!PrintAliases || !printAliasInstr(MI, Address, STI, O))
printInstruction(MI, Address, STI, O);
|
f8f5688 to
914f19d
Compare
f88e35a to
55e234b
Compare
55e234b to
ff4fc23
Compare
4789335 to
a233e69
Compare
e488057 to
15d65d9
Compare
TSB instruction has one operand, but the generated disassembler didn't decode this operand. AArch64InstPrinter had a workaround for this. This instruction can now be disassembled correctly.
a233e69 to
cefa6c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/163/builds/25981 Here is the relevant piece of the build log for the reference |

TSB instruction has one operand, but the generated disassembler is unable to decode it since the operand is not encoded into the instruction. AArch64InstPrinter has a special case for this -- if the instruction being printed is TSB, it prints the only possible operand value, regardless of whether the operand is present or not.
With the changes proposed by #156358, the operand can now be decoded automatically and the workaround is no longer required.